<?php
class CPhpMailer extends CApplicationComponent{
	public $_myMailer;
	
	public $host = 'localhost';
	public $port = 25;
	public $mailPath = '/usr/sbin/sendmail';
	public $secure = '';
	public $auth = false;
	public $username = '';
	public $password = '';
	public $debug = false;
	
	public function __construct(){
		require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'phpmailer'.DIRECTORY_SEPARATOR.'class.phpmailer.php');
		$this->_myMailer = new PHPMailer();
	}
	
	public function send($to,$subject,$body,$cc=array()){
		$this->_myMailer->Host = $this->host;
		$this->_myMailer->Port = $this->port;
		$this->_myMailer->Sendmail = $this->mailPath;
		$this->_myMailer->SMTPSecure = $this->secure;
		$this->_myMailer->SMTPAuth = $this->auth;
		$this->_myMailer->Username = $this->username;
		$this->_myMailer->Password = $this->password;
		$this->_myMailer->SMTPDebug = $this->debug;
		$this->_myMailer->IsSMTP();
		
		$this->_myMailer->Subject = $subject;
		$this->_myMailer->Body = $body;
		$this->_myMailer->AddAddress($to);
		$this->_myMailer->Send();
	}
}